package com.wjk.kylin.modules.system.notice.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjk.kylin.modules.system.notice.entity.Notice;
import com.wjk.kylin.modules.system.notice.mapper.NoticeMapper;
import com.wjk.kylin.modules.system.notice.service.INoticeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;


/**
 * <p>
 *  通知表 服务实现类
 * </p>
 *
 * @author wangjkui
 * @since 2020-06-01
 */
@Service
@Transactional(readOnly=true)
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {

    @Override
    public IPage<Notice> findPage(Page<Notice> page, Notice notice) {
        return baseMapper.findPage(page,notice);
    }

    @Override
    @Transactional(readOnly=false)
    public boolean save(Notice notice) {
        notice.preInsert();
        return super.save(notice);
    }

    @Override
    @Transactional(readOnly=false)
    public boolean update(Notice notice) {
        notice.preUpdate();
        return super.updateById(notice);
    }

    @Override
    @Transactional(readOnly=false)
    public boolean deleteByIds(String[] noticeIds) {
        return super.removeByIds(Arrays.asList(noticeIds));
    }
}
